<template>
	<view class="scroll-style" style="padding: 0 30rpx;">
		<view class="title">标题</view>
		<view>
			<u--textarea v-model="title" placeholder="请输入问题的标题~" :height="60" count maxlength="25"></u--textarea>
		</view>
		<view class="title">内容</view>
		<view>
			<u--textarea v-model="content" placeholder="请输入具体内容~" :height="250" count maxlength="1000"></u--textarea>
		</view>
		<button class="submit" @click="submit">提交建议</button>
	</view>
</template>

<script>
	import { addSuggest } from '@/api/index/index'
	export default {
		data() {
			return {
				title: '',
				content: ''
			}
		},
		onLoad() {

		},
		methods: {
			submit() {
				if (!this.title) {
					this.$api.msg('请输入标题');
					return;
				}
				if (!this.content) {
					this.$api.msg('请输入具体内容');
					return;
				}
				addSuggest({
					title: this.title,
					content: this.content
				}, response => {
					this.$api.msg('提交成功');
					setTimeout(() => {
						uni.navigateBack({});
					}, 1500);
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.title {
		margin: 50rpx 0 20rpx;
		font-size: 30rpx;
		color: #646464;
	}
	
	.submit {
		margin-top: 40rpx;
		width: 690rpx;
		height: 90rpx;
		line-height: 90rpx;
		font-size: 30rpx;
		color: #fff;
		background-color: #1B77EF;
		border-radius: 90rpx;
	}
</style>